from gi.repository import Gtk

class CellRendererToggleWindow(Gtk.Window):

    def __init__(self):
        Gtk.Window.__init__(self, title='CellRendererToggle Demo')

        self.set_default_size(200, 200)

        self.liststore = Gtk.ListStore(str, bool, bool)
        self.liststore.append(['Debian', False, True])
        self.liststore.append(['OpenSuse', True, False])
        self.liststore.append(['Fedore', False, False])

        treeview = Gtk.TreeView(model=self.liststore)
        treeview.set_headers_visible(False)

        renderer_text = Gtk.CellRendererText()
        col_txt = Gtk.TreeViewColumn('Text', renderer_text, text=0)
        treeview.append_column(col_txt)

        renderer_toggle = Gtk.CellRendererToggle()
        renderer_toggle.connect('toggled', self.on_cell_toggled)
        col_toggle =Gtk.TreeViewColumn('Toggle', renderer_toggle, active=1)
        treeview.append_column(col_toggle)

        renderer_radio = Gtk.CellRendererToggle()
        renderer_radio.set_radio(True)
        renderer_radio.connect('toggled', self.on_cell_radio_toggled)
        col_radio = Gtk.TreeViewColumn('Radio', renderer_radio, active=2)
        treeview.append_column(col_radio)

        self.add(treeview)

    def on_cell_toggled(self, widget, path):
        self.liststore[path][1] = not self.liststore[path][1]


        iter = self.liststore.get_iter(path)
        self.liststore.remove(iter)

    def on_cell_radio_toggled(self, widget, path):
        selected_path = Gtk.TreePath(path)
        for row in self.liststore:
            row[2] = (row.path == selected_path)

win = CellRendererToggleWindow()
win.connect('delete-event', Gtk.main_quit)
win.show_all()
Gtk.main()